<!-- Main Sidebar Container -->
<aside class="main-sidebar sidebar-dark-primary elevation-4">
      <!-- Brand Logo -->
    <a href="/homepage" class="brand-link">
      <img src="/static/adminlte/dist/img/favicon.ico" alt="OneLink CUP" class="brand-image img-circle elevation-3" style="opacity: .8">
      <span class="brand-text font-weight-light">OneLinkCup</span>
    </a>
    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar user panel (optional) -->
      <div class="user-panel mt-3 pb-3 mb-3 d-flex">
      {% if user.is_authenticated %}
        <div class="image">
          <img src="/static/adminlte/dist/img/u.png" class="img-circle elevation-2" alt="User Image">
        </div>
        <div class="info">
          <a href="#" class="d-block">
              {{ user.first_name }}({{ user }})
          </a>
        </div>
      {% else %}
        <div class="info">
            <a href="/account/login" class="d-block">
              登录</a>
        </div>
      {% endif %}
      </div>

      <!-- SidebarSearch Form -->
      <div class="form-inline">
        <div class="input-group" data-widget="sidebar-search">
          <input class="form-control form-control-sidebar" type="search" placeholder="Search" aria-label="Search">
          <div class="input-group-append">
            <button class="btn btn-sidebar">
              <i class="fas fa-search fa-fw"></i>
            </button>
          </div>
        </div>
      </div>
      <!-- /.search form -->

      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <li class="nav-item">
            <a href="#" class="nav-link active">
              <i class="nav-icon fas fa-tachometer-alt"></i>
              <p>
                Dashboard
                <i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item">
                <a href="/ansible/mydashboard" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>我的报表</p>
                </a>
              </li>
            </ul>
          </li>
          {% if perms.public.host_view or perms.public.host_manage or perms.public.playbook_manage %}
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-file"></i>
              <p>资源管理<i class="right fas fa-angle-left"></i></p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item"><a href="/ansible/hostslist" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>服务器管理</p></a></li>
              <li class="nav-item"><a href="/ansible/hostsinfo" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>资源使用统计</p></a></li>
                {% if perms.public.asset_manage %}
                    <li class="nav-item"><a href="/ansible/assets" class="nav-link"><i class="far fa-circle nav-icon"></i>
                        <p>资产列表</p></a></li>
                {% endif %}
                {% if perms.public.system_manage %}
                    <li class="nav-item"><a href="/ansible/systemslist" class="nav-link"><i class="far fa-circle nav-icon"></i>
                        <p>系统管理</p></a></li>
                {% endif %}
              <li class="nav-item"><a href="/ansible/applicationlist" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>应用管理</p></a></li>
            </ul>
          </li>
        {% endif %}
        {% if perms.public.ansible_executeplaybook or perms.public.ansible_view or perms.public.ansible_trans_views or perms.public.ansible_trans%}
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-chart-pie"></i>
              <p>Ansible 任务<i class="right fas fa-angle-left"></i></p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item"><a href="/ansible/playbooklist" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>Playbook管理</p></a></li>
              <li class="nav-item"><a href="/ansible/ansiblerolelist" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>AnsibleRole</p></a></li>
              <li class="nav-item"><a href="/ansible/softwarelist" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>软件包</p></a></li>
              <li class="nav-item"><a href="/ansible/task" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>任务列表</p></a></li>
             <!--  <li><a href="/ansible/edit_task"><i class="fa fa-circle-o"></i> 执行任务</a></li> -->
                {% if perms.public.ansible_execute_playbook%}
              <li class="nav-item"><a href="/ansible/edit_task/1" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>Playbook执行</p></a></li>
                    {% endif %}
                {% if perms.public.ansible_trans%}
              <li class="nav-item"><a href="{% url 'transpackage' %}" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>分发数据包</p></a></li>
                    {% endif %}
                {% if perms.public.ansible_trans_views%}
              <li class="nav-item"><a href="{% url 'ansibleroledownloadtasks' %}" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>分发数据包任务列表</p></a></li>
                    {% endif %}
            </ul>
          </li>
        {% endif %}
            {% if perms.public.auth_view or perms.public.role_manage or perms.public.user_manage %}
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-paint-brush"></i>
              <p>权限管理<i class="right fas fa-angle-left"></i></p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item"><a href="/ansible/userlist/1" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>用户管理</p></a></li>
              <li class="nav-item"><a href="/ansible/rolelist/1" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>角色管理</p></a></li>
            </ul>
          </li>
            {% endif %}
        {% if perms.public.celery_view %}
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-columns"></i>
              <p>
                系统监控
                <i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item"><a href="/celery/node/" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>Worker状态</p></a></li>
              <li class="nav-item"><a href="/ansible/middlemonitor/" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>Prometheus状态</p></a></li>
            </ul>
          </li>
        {% endif %}
        {% if perms.myscheduler.Scheduler_view %}
        <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-calendar-alt"></i>
              <p>定时任务<i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item"><a href="/myscheduler/schedulertypelist/" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>任务模板</p></a></li>
              <li class="nav-item"><a href="/myscheduler/schedulerjoblist/" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>定时任务列表</p></a></li>
              <li class="nav-item"><a href="/myscheduler/schedulerjobresult/" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>定时任务结果</p></a></li>
            </ul>
          </li>
        {% endif %}
        {% if perms.public.question_view %}
          <li class="nav-item">
            <a href="#" class="nav-link">
              <i class="nav-icon fas fa-phone"></i>
              <p>
                Q&A
                <i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item"><a href="/chatbot/chat" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>知识图谱</p></a></li>
              <li class="nav-item"><a href="/chatbot/upload_file" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>知识学习</p></a></li>
              <li class="nav-item"><a href="/chatbot/opbot" class="nav-link"><i class="far fa-circle nav-icon"></i>
                  <p>维护助手</p></a></li>
    {#          <li class="active"><a href="/doc_v1/" target="_blank"><i class="fa fa-circle-o"></i> API 文档1</a></li>#}
    {#          <li class="active"><a href="/doc_v2/" target="_blank"><i class="fa fa-circle-o"></i> API 文档2</a></li>#}

    <!--          <li><a href="/celery/node/"><i class="fa fa-circle-o"></i> Celery Nodes</a></li>-->
    <!--          <li><a href="/celery/node/"><i class="fa fa-circle-o"></i> Celery Details</a></li>-->
            </ul>
          </li>
        {% endif %}
        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
</aside>
